/*
 * ControlVS.java
 *
 */
package cn.com.sbell.vss.csg.vap;

import org.dom4j.Element;

import cn.com.sbell.vss.VssConstants;
import cn.com.sbell.vss.VssException;
import cn.com.sbell.vss.csg.vsclient.VsClient;
import cn.com.sbell.vss.csg.vsclient.util.PropertiesHolder;

/**
 *
 * @author Yifu.HUANG
 */
public class ControlVS extends ProtectedVsCommander {
    
	protected Element executeCommand(VsClient vsClient, PropertiesHolder holder, Element root) {
		Integer action = holder.getIntProperty("action");
		if(action == null){
			throw new VssException(VssConstants.CODE_REQUIRED,new String[]{"csg.action"});
		}     
		if(!vsClient.controlVs(action.intValue())){
		    throw new VssException(VssConstants.CODE_CONTROLVS_FAILED);
		}
		return root;
	}
}
